<?php

/**
 * 竞拍握手
 *
 * Created by PhpStorm.
 * user: Evan
 * Date: 16/8/8
 * Time: 上午1:20
 */
class Handshake extends MY_Api_Controller
{
    /**
     * 发起
     */
    public function launch()
    {
        $aid        = (int)$this->input->get_post('aid');
        $uid        = $this->uid;
        $is_publish = (int)$this->input->get_post('is_publish');
        $is_ticket  = (int)$this->input->get_post('is_ticket');
        $ticket_fee = (double)$this->input->get_post('ticket_fee');


        $this->load->service('auction/service_auction_handshake');
        $data = $this->service_auction_handshake->launch($aid, $uid, $is_publish, $is_ticket, $ticket_fee);


        $this->json_output($data['data'], $data['status']);
    }


    public function confirm_info()
    {
        $aid        = (int)$this->input->get_post('aid');
        $uid        = $this->uid;


        $this->load->service('auction/service_auction_handshake');
        $data = $this->service_auction_handshake->confirm_info($aid, $uid);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 确认握手
     */
    public function confirm()
    {
        $aid        = (int)$this->input->get_post('aid');
        $uid        = $this->uid;
        $opinion    = (int)$this->input->get_post('opinion');
        $is_ticket  = (int)$this->input->get_post('is_ticket');
        $ticket_fee = (double)$this->input->get_post('ticket_fee');
        $ratio = (int)$this->input->get_post('ratio');


        $this->load->service('auction/service_auction_handshake');
        $data = $this->service_auction_handshake->confirm($aid, $uid, $is_ticket, $opinion, $ticket_fee, $ratio);


        $this->json_output($data['data'], $data['status']);
    }

}